package com.qf.smartdevice.controller;

import com.qf.smartdevice.dto.R;
import com.qf.smartdevice.pojo.Menus;
import com.qf.smartdevice.service.IMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/menus")
public class MenuController {
    @Autowired
    private IMenuService menuService;
    @GetMapping("/menus")
    public R getMenus(){
        //通过 service 调用 mapper 最终返回所有的菜单
        List<Menus> menusList=menuService.findAllMenus();

        return R.setOK(menusList);//设置返回结果,通过统一的返回格式进行返回
    }
}
